package io.terminus.spzx.feign.product;

import io.terminus.spzx.model.dto.product.SkuSaleDto;
import io.terminus.spzx.model.entity.product.ProductSku;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author lichunlong lcl253137@alibaba-inc.com
 * @desc 商品OpenFeign客户端
 * @date 2024-11-19
 */
@FeignClient(name = "service-product")
public interface ProductFeignClient {

    /**
     * 根据SKU ID查询商品SKU
     *
     * @param skuId SKU ID
     * @return 商品SKU
     */
    @GetMapping("/api/product/getBySkuId/{skuId}")
    ProductSku getBySkuId(@PathVariable Long skuId);

    /**
     * 更新商品sku销量
     *
     * @param skuSaleDtoList sku销量列表
     * @return 更新结果
     */
    @PostMapping("/api/product/updateSkuSaleNum")
    Boolean updateSkuSaleNum(@RequestBody List<SkuSaleDto> skuSaleDtoList);
}
